package org.example.mapper;

import org.apache.ibatis.annotations.*;
import org.example.pojo.ClassAccount;

import java.util.List;

@Mapper
public interface ClassAccountMapper {
    @Insert("insert into class_account " +
            "values (NULL,#{classCode},#{eventName},#{eventDate},#{totalCost},#{costSource},#{coordinator},now(),now())")
    public void addClassAccount(ClassAccount classAccount);

    @Delete("delete from class_account where id = #{id}")
    public void deleteClassAccountById(int id);

    @Update("update class_account " +
            "set class_code = #{classCode}, event_name = #{eventName}, event_date = #{eventDate}, " +
            "total_cost = #{totalCost}, cost_source = #{costSource}, coordinator = #{coordinator}, update_date_time = now() " +
            "where id = #{id}")
    public void updateClassAccountById(ClassAccount classAccount);

    @Select("select * from class_account where class_code = #{classCode}")
    public List<ClassAccount> queryClassAccountByClassId(String classCode);
}
